function cancelUpload(){
	$("#thumbnail>img").hide('fast');
	$("#thumbnail").html('');
	$("#PartCategoryPhoto").val('');
	$("#upload").show();	
}
function uploadSuccess1(file, serverData) {
	try {		
		fileuploaded = FILEUPLOAD+file.type;
		$("#thumbnail").html('<a class="upload_close" href="#" target="_self" onclick="cancelUpload();return false;">&nbsp;&nbsp;</a><img src="'+PATHUPLOAD+fileuploaded+'" class="thumbnail" />');
		$("#PartCategoryPhoto").val(fileuploaded);
		$("#upload").hide();
		$("#fsUploadProgress").hide();
		progress.toggleCancel(false);
		progress.setStatus("Done");	
	} catch (ex) {
		
	}
}
function uploadStart1(file) {
	try {
		this.addPostParam("path", FOLDERUPLOAD);
		this.addPostParam("file", FILEUPLOAD);
		$("#fsUploadProgress").show();
		var progress = new FileProgress(file, this.customSettings.progressTarget);		
		progress.toggleCancel(true, this);
		progress.setStatus("Uploading...");		
	}
	catch (ex) {}
	
	return true;
}
function uploadProgress1(file, bytesLoaded, bytesTotal) {
	try {		
		var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);
		var progress = new FileProgress(file, this.customSettings.progressTarget);
		progress.setProgress(percent);
		progress.setStatus("Uploading...");
	} catch (ex) {
		this.debug(ex);
	}
}
function uploadError1(file, errorCode, message) {
	try {
		var progress = new FileProgress(file, this.customSettings.progressTarget);
		progress.setError();
		progress.toggleCancel(false);

		switch (errorCode) {
		case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
			progress.setStatus("Upload Error: " + message);
			alert("Error Code: HTTP Error, File name: " + file.name + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
			progress.setStatus("Upload Failed.");
			alert("Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.IO_ERROR:
			progress.setStatus("Server (IO) Error");
			alert("Error Code: IO Error, File name: " + file.name + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
			progress.setStatus("Security Error");
			alert("Error Code: Security Error, File name: " + file.name + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
			progress.setStatus("Upload limit exceeded.");
			alert("Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
			progress.setStatus("Failed Validation.  Upload skipped.");
			alert("Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
			// If there aren't any files left (they were all cancelled) disable the cancel button
			if (this.getStats().files_queued === 0) {
				document.getElementById(this.customSettings.cancelButtonId).disabled = true;
			}
			progress.setStatus("Cancelled");
			progress.setCancelled();
			break;
		case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
			progress.setStatus("Stopped");
			break;
		default:
			progress.setStatus("Unhandled Error: " + errorCode);
			alert("Error Code: " + errorCode + ", File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
			break;
		}
	} catch (ex) {
        alert(ex);
    }
}

